package com.xiaoma.tpo.dto;

import org.apache.commons.lang.StringUtils;

public class LoginDto implements Validator{

    private String name;
    private String password;
    private String device;
    private String loginFrom;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getDevice() {
        return device;
    }
    public void setDevice(String device) {
        this.device = device;
    }
    public String getLoginFrom() {
        return loginFrom;
    }
    public void setLoginFrom(String loginFrom) {
        this.loginFrom = loginFrom;
    }
    @Override
    public String validate() {
        String result = "";
        if(StringUtils.isEmpty(this.name)) {
            this.name = null;
            result += "(name is empty)";
        }
        if(StringUtils.isEmpty(this.password)) {
            this.password = null;
            result += " (password is empty)";
        }
        if(StringUtils.isEmpty(this.loginFrom)) {
            this.loginFrom = null;
            result += " (loginFrom is empty)";
        }
        return result;
    }
    
    
    
}
